package com.jht.pj.sys.controller;

import com.jht.pj.sys.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class AdminController {
    @Autowired
    private AdminService adminService;
    /*管理员登录*/
    @GetMapping("/doAdmin")
    public String doAdmin(){

        return "Admin";
    }
    @PostMapping("/doAdminObject")
    public String doAdminObject(@RequestParam String username,
                                @RequestParam String password,
                                Model model){
        String result=adminService.adminloginObject(username, password);
        model.addAttribute("result", result);
            return "Admin";
        }
    /*管理员找回密码*/
    @PostMapping("/doAdminFind")
    public String doAdminFind(){
        return "Admin_find";
    }
    @PostMapping("/doAdminFindObject")
     public String doAdminFindObject(@RequestParam("name") String name,
                                        Model model){
        String result01=adminService.adminfindObject(name);
        model.addAttribute("result01",result01);
        return "Admin_find";
     }
}





